<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="style">
</head>

<body>
    <form class="layui-form">
        <div>
            姓名: <input type="text" name="username" id="username" ley-verify='required'>
        </div>
        <div>
            密码: <input type="text" name="password" id="password" ley-verify='required'>
        </div>
        <div>
            邮箱: <input type="text" name="email" id="email" ley-verify='required|email'>
        </div>
        <button lay-submit>提交</button>
    </form>
    <script></script>
    <script>
        //   form模块：
        //     1. form元素 class="layui-form"
        //     2. button: lay-submit;
        //     3. 查文档可以使用：内置规则要求：不能为空！表单元素 添加  lay-verify="内置规则名"
        //        内置：layui.form;  required
        layui.use('form', function () {
            let form = layui.form;
            $('form').on('submit', function (e) {
                e.preventDefault()
            })
        })
    </script>
</body>

</html>